import request from '@/request/request'

// 分页获取组装单
export function getAssemblyOrderPage(pageParams) {
    return request({
        method: "get",
        url: '/warehouse/assembly/page',
        params: pageParams
    })
}

// 创建组装单
export function createAssemblyOrder(assemblyOrder) {
    return request({
        method: "post",
        url: '/warehouse/assembly',
        data: assemblyOrder
    })
}

// 获取组装单详情（包含明细）
export function getAssemblyOrderWithDetails(id) {
    return request({
        method: "get",
        url: `/warehouse/assembly/withDetails/${id}`,
    })
}

// 更新组装单
export function updateAssemblyOrder(assemblyOrder) {
    return request({
        method: "put",
        url: '/warehouse/assembly',
        data: assemblyOrder
    })
}

// 删除组装单
export function deleteAssemblyOrder(id) {
    return request({
        method: "delete",
        url: `/warehouse/assembly/${id}`,
    })
}

// 完成组装单
export function completeAssemblyOrder(id) {
    return request({
        method: "put",
        url: `/warehouse/assembly/complete/${id}`,
    })
}
